package com.entrogy.service.impl;

import com.entrogy.bean.AttendanceGroupEntity;
import com.entrogy.dao.AttendanceGroupMapper;
import com.entrogy.service.AttendanceGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**考勤组管理service接口实现类
 * @Author 许红松
 * @date 2019/5/9 0009 下午 4:27
 */
@Service("attendanceGroupService")
public class AttendanceGroupServiceImpl  implements AttendanceGroupService {

    @Autowired
    private AttendanceGroupMapper attendanceGroupMapper;//考勤组管理dao接口

    /**
     * 新增考勤组
     * @param attendanceGroupEntity
     * @return
     */
    @Override
    public int addAttendanceGroup(AttendanceGroupEntity attendanceGroupEntity) {

        return attendanceGroupMapper.addAttendanceGroup(attendanceGroupEntity);
    }

    /**
     * 修改考勤组信息
     * @param attendanceGroupEntity
     * @return
     */
    @Override
    public int updateAttendanceGroup(AttendanceGroupEntity attendanceGroupEntity) {

        return attendanceGroupMapper.updateAttendanceGroup(attendanceGroupEntity);
    }

    /**
     * 删除考勤组信息
     * @param attendanceId
     * @return
     */
    @Override
    public int deleteAttendanceGroup(int attendanceId) {

        return attendanceGroupMapper.deleteAttendanceGroup(attendanceId);
    }

    /**
     *   考勤人员查询  不能再重复的考勤组
     * @param map
     * @return
     */
    @Override
    public List<Map<String,Object>> getUserList(Map<String,Object> map){
        return attendanceGroupMapper.getUserList(map);
    };

    /**
     * 获取考勤组list 总数
     * @return
     */
    @Override
    public Integer getUserListTotal(Map<String,Object> map){
        Integer   m=attendanceGroupMapper.getUserListTotal(map);
        if (m==null || m==0){
            return 0;
        }
        return m;
    }



    /**
     * 获取考勤组list
     * @return
     */
    @Override
    public List<Map<String, Object>> getAttendanceGroupList(Map<String, Object> map) {

        return attendanceGroupMapper.getAttendanceGroupList(map);
    }
}
